#include "iolayer.hpp"
typedef enum
{
	none = -1,
	other = -2,
	accel = 0x180,
	angula = 0x280,
	euler = 0x380,
	quad = 0x480,
	pascal = 0x680
} imu_frame_id;



class imu_controller
{
	private:
	std::shared_ptr<iolayer::layer_socket> sock;
	int device_id;
	uint8_t recv_buf[8];
	public:
	imu_controller(std::shared_ptr<iolayer::layer_socket> sock, int device_id);

	imu_frame_id read_frame();

	int get_data_as_accel(int &x, int &y, int &z);

	int get_data_as_angula(int &x, int &y, int &z);

	int get_data_as_euler(int &roll, int &pitch, int &yaw);

	int get_data_as_quad(int &qw, int &qx, int &qy, int &qz);

	int get_data_as_pascal(int &pa);

	int get_data_as_bytes(uint8_t data[8]);

	int write_frame(int id, int sdo, int index, int sub, int data);

	int write_devid(int id);

	int write_freq_accel(int level);

	int write_freq_angula(int level);

	int write_freq_euler(int level);

	int write_freq_quad(int level);

	int write_freq_pascal(int level);
};
